package vcp.enums.utility;
/**
 * 
 * @author VCP team
 *<p> class thet reverses enum to its value </p>
 */
public class EnumReverser
{
	public interface IEnumReverser
	{

	}
	/**
	 * convert method
	 * @param type
	 * @param key
	 */
	public static <T extends IEnumReverser> T convert ( Class <T> type, String key )
	{
		T returnType = null;
		for ( T searchType : type.getEnumConstants() )
		{
			if ( searchType.toString().equalsIgnoreCase(key) )
			{
				returnType = searchType;
				break;
			}
		}

		return returnType;
	}
}
